package com.situ.mall.controller.front;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.situ.mall.entity.Product;
import com.situ.mall.service.IProductService;

@Controller
@RequestMapping(value="/product")
public class FrontProductController {
	@Autowired
	private IProductService productService;
	
	//商品展示页面
	@RequestMapping(value="/getProductListPage.shtml")
	public String getProductListPage(Integer categoryId,Model model) {
		System.out.println(categoryId);
		List<Product> productList = productService.selectProduct(categoryId);
		model.addAttribute("productList",productList);
		System.out.println(productList);
		return "product/product_list";
	}
	
	//商品详情页
	@RequestMapping(value="/getProductDetailPage.shtml")
	public String getProductDetailPage(Integer id,Model model) {
		Product product = productService.selectProductDetail(id);
		model.addAttribute("product",product);
		return "product/product_detail";
	}
}
